package com.hw.nio.netty.rpc;


import java.io.Serializable;

public class Transfer implements Serializable {
    public static final byte STATUS_ERROR = 0;
    public static final byte STATUS_OK = 1;
    public static final byte STATUS_ILLEGAL = 2;
    public static final byte SERIALIZABLE_JAVA = 1;
    public static final byte SERIALIZABLE_HESSIAN2 = 2;
    public static final byte SERIALIZABLE_JSON = 3;

    public boolean request;
    public byte serializableId; // 1:java 2:hessian2 3:json
    public boolean twoWay;
    public boolean heartbeat;
    public long id;
    public byte status;    // 1正常 0失败 2请求非法
    public Object target;

    public Transfer(long id) {
        this.id = id;
    }

    void copy(Transfer from) {
        this.request = from.request;
        this.serializableId = from.serializableId;
        this.twoWay = from.twoWay;
        this.heartbeat = from.heartbeat;
        this.id = from.id;
        this.status = from.status;
        this.target = from.target;
    }

    @Override
    public String toString() {
        return "Transfer{" +
                "request=" + request +
                ", serializableId=" + serializableId +
                ", twoWay=" + twoWay +
                ", heartbeat=" + heartbeat +
                ", id=" + id +
                ", status=" + status +
                ", target=" + target +
                '}';
    }
}
